package com.daffodil.workable.entity;

import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.GenericGenerator;

import com.daffodil.core.annotation.Hql;
import com.daffodil.core.annotation.Hql.Logical;
import com.daffodil.core.entity.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * -节点信息对象
 * @author yweijian
 * @date 2022-04-07
 * @version 1.0
 * @description
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Entity
@Table(name = "wok_node")
public class WorkableNode extends BaseEntity<String> {

    private static final long serialVersionUID = 6825672676891369320L;

    /** 主键编号 */
    @Id
    @GeneratedValue(generator = "uuid")
    @GenericGenerator(name = "uuid", strategy = "uuid")
    @Column(name = "id")
    private String id;
    
    /** 模型编号 */
    @Column(name = "model_id")
    @Hql(type = Logical.EQ)
    private String modelId;

    /** 任务编号 */
    @Column(name = "task_id")
    @Hql(type = Logical.EQ)
    private String taskId;

    /** 节点编号 */
    @Column(name = "node_id")
    @Hql(type = Logical.EQ)
    private String nodeId;

    /** 左边距 */
    @Column(name = "position_left")
    private String left;

    /** 上边距 */
    @Column(name = "position_top")
    private String top;

    /** 样式 */
    @Column(name = "css_class")
    private String cssClass;

    /** 名称 */
    @Column(name = "name")
    @Hql(type = Logical.LIKE)
    private String name;

    /** 图标 */
    @Column(name = "icon")
    private String icon;

    /** 类型 */
    @Column(name = "type")
    @Hql(type = Logical.EQ)
    private String type;
    
    /** 创建者 */
    @Column(name = "create_by")
    @Hql(type = Logical.EQ)
    private String createBy;

    /** 创建时间 */
    @Column(name = "create_time")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /** 更新者 */
    @Column(name = "update_by")
    @Hql(type = Logical.EQ)
    private String updateBy;

    /** 更新时间 */
    @Column(name = "update_time")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    /** 节点表单 */
    @Transient
    private WorkableForm workableForm;
    
    /** 输出连线 */
    @Transient
    List<WorkableLine> targetLineList;
    
    /** 输出节点 */
    @Transient
    List<WorkableNode> targetNodeList;

}
